﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PhotoOfTheDay.Types;

namespace PhotoOfTheDay
{
    public partial class CustomizeWallpaper : Form
    {
        public CustomizeWallpaper()
        {
            InitializeComponent();
        }

        private void CustomizeWallpaper_Load(object sender, EventArgs e)
        {
            switch (Global.CurrentConfig.Style)
            {
                case Wallpaper.Style.Tiled:
                    wallpaper_style.SelectedIndex = 0;
                    break;
                case Wallpaper.Style.Centered:
                    wallpaper_style.SelectedIndex = 1;
                    break;
                case Wallpaper.Style.Stretched:
                    wallpaper_style.SelectedIndex = 2;
                    break;
                default:
                    wallpaper_style.SelectedIndex = 0;
                    break;
            }
        }

        private void close_button_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void save_button_Click(object sender, EventArgs e)
        {
            switch (wallpaper_style.SelectedIndex)
            {
                case 0:
                    Global.CurrentConfig.Style = Wallpaper.Style.Tiled;
                    break;
                case 1:
                    Global.CurrentConfig.Style = Wallpaper.Style.Centered;
                    break;
                case 2:
                    Global.CurrentConfig.Style = Wallpaper.Style.Stretched;
                    break;
            }
            Global.CurrentConfig.Save(Global.ConfigPath);
            Close();
        }
    }
}
